﻿using System;
using SillyCube.Behavior;
using UnityEngine;

namespace SillyCube
{
    public class CubeController : MonoBehaviour
    {
        private CubeBehaviorBase _behavior;

        private void Awake()
        {
            _behavior = GetComponent<CubeBehaviorBase>();
        }

        public void Jump(Vector3 forceVec)
        {
            _behavior.OnForceApply(new CubeBehaviorForceEventInfo
            {
                rawForce = forceVec
            });
        }

        public bool OnCameraTick(Transform cameraTransform)
        {
            return _behavior.OnCameraMove(new CubeBehaviorCameraMoveInfo()
            {
                cameraTransform = cameraTransform
            });
        }

        public float GetMaxForceMagnitude()
        {
            return _behavior.GetMaxForceMagnitude();
        }

        public bool AllowDragForce()
        {
            return _behavior.AllowDragForce();
        }
    }
}